<!-- src/views/Auth/Register.vue -->
<template>
  <div class="logo-container">
    <img src="/public/logo.png" alt="logo" class="logo" />
  </div>
  <div class="register-container">
    <div class="register-form">
      <h2 class="register-title">注册</h2>

      <div class="form-group">
        <label>用户名</label>
        <input type="text" placeholder="请输入用户名" v-model="username" />
      </div>

      <div class="form-group">
        <label>手机号</label>
        <input type="tel" placeholder="请输入手机号" v-model="phone" />
      </div>

      <div class="form-group">
        <label>密码</label>
        <input type="password" placeholder="请输入密码" v-model="password" />
      </div>

      <div class="form-group">
        <label>确认密码</label>
        <input
          type="password"
          placeholder="请再次输入密码"
          v-model="confirmPassword"
        />
      </div>

      <button
        class="register-btn"
        @click="handleRegister"
        @click.prevent="goToLogin"
      >
        注册
      </button>

      <div class="auth-links">
        <span>已有账号？</span>
        <a href="#" @click.prevent="goToLogin">立即登录</a>
      </div>
    </div>
    <div class="login-img">
      <img src="./loginimg.png" alt="" />
    </div>
  </div>
</template>

<script>
export default {
  name: "RegisterPage",
  data() {
    return {
      username: "",
      phone: "",
      password: "",
      confirmPassword: "",
    };
  },
  methods: {
    handleRegister() {
      // 处理注册逻辑
      console.log("注册信息:", {
        username: this.username,
        phone: this.phone,
        password: this.password,
      });
    },
    goToLogin() {
      // 跳转登录页面
      this.$router.push("/login");
    },
  },
};
</script>

<style scoped>
.register-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: rgb(244, 223, 161);
}

/* 登录图片 */
.login-img img {
  width: 600px;
  height: 600px;
}

/* logo */
.logo-container {
  position: absolute;
  top: 8px;
  left: 8px;
}

.logo {
  height: 85px; /* 根据实际图片调整高度 */
  width: auto;
}

.register-form {
  width: 400px;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.register-title {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.register-btn {
  width: 100%;
  padding: 12px;
  background-color: black;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.register-btn:hover {
  background-color: rgb(95, 95, 93);
}

.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 8px;
}

.auth-links a {
  color: black;
  text-decoration: none;
  font-size: 14px;
}

.auth-links a:hover {
  text-decoration: underline;
  color: red;
}
</style>
